import '../../../style/outSign.less';
import React, {Component} from 'react';
import {observer} from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { RouteLayout } from 'weaver-mobile-page';
import { Tools } from 'weaver-mobile';
import TitlePage from '../../coms/TitlePage';
import RecordList from '../record/RecordList';
const getLabel = Tools.getLabel;


@withRouter
@observer
export default class RecordRouteLayout extends Component {
  constructor(props){
    super(props);
  }

  componentDidMount(){
    this.init();
  }

  init = () => {
    const {state} = this.props.location;
    if(state != null) {
        const {data} = state;
        this.setState({data});
        this.props.store.querySubordinates(data);
    }
  }

  render() {
    // const {state} = this.props.location;
    const {store} = this.props;
    const {subordinates} = store;
    if(subordinates == null)
      return (
        <RouteLayout>
            <div className='wm-route-layout'>
            </div>
        </RouteLayout>
    );

    let title = getLabel('504542','{param}的外勤');
    title = title.replace('{param}', subordinates.lastname); 

    return (
        <RouteLayout>
            <div className='wm-route-layout recordContainer'>
                <TitlePage title={title}>
                    <RecordList store={store} style={{top: 0}} resourceId={subordinates.id}/>
                </TitlePage>
            </div>
        </RouteLayout>
    )
  }
}